<!--计费设置-->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>计费设置</title>
    <link rel="stylesheet" href="../css/layui.css">
    <link rel="stylesheet" href="../css/bootstrap.min.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">MISS后台管理系统</div>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                    username
                </a>
            </li>
            <li class="layui-nav-item"><a href="">注销</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <!-- 侧边导航: <ul class="layui-nav layui-nav-tree layui-nav-side"> -->
                <li class="layui-nav-item">
                    <a href="index.html">首页</a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">散客开单</a>
                    <dl class="layui-nav-child">
                        <dd><a href="Guests_check_in.html">宾客入住</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">订单</a>
                    <dl class="layui-nav-child">
                        <dd><a href="Order.html">所有订单</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">宾客结账</a>
                    <dl class="layui-nav-child">
                        <dd><a href="Ordinary_invoicing.html">普通结账</a></dd>
                        <dd><a href="Members_to_check.html">会员结账</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">预定管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="Add_a_reservation.html">添加预定</a></dd>
                        <dd><a href="Delete_reservation.html">删除预定</a></dd>
                        <dd><a href="Edit_reservation.html">编辑预定</a></dd>
                        <dd><a href="Query_book.html">查询预定</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">营业查询</a>
                    <dl class="layui-nav-child">
                        <dd><a href="Room_query.html">房间查询</a></dd>
                        <dd><a href="Check-in_guest_enquiry.html">入住宾客查询</a></dd>
                        <dd><a href="Member_of_the_query.html">会员查询</a></dd>
                        <dd><a href="Fuzzy_membership_query.html">模糊查询会员</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item layui-nav-itemed">
                    <a href="javascript:;">系统设置</a>
                    <dl class="layui-nav-child">
                        <dd><a href="Data_management.html">数据管理</a></dd>
                        <dd><a href="VIP_set_up.html">VIP设置</a></dd>
                        <dd><a href="Billing_Settings.html" style="background-color: #1E90FF">计费设置</a></dd>
                        <dd><a href="Set_up_the_room.html">房间设置</a></dd>
                        <dd><a href="Operator_setup.html">操作员设置</a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <div style="padding: 15px;">
        	<div class="layui-tab layui-tab-card" >
			  <ul class="layui-tab-title">
			    <li class="layui-this">房间打折</li>
			    <li>会员打折</li>
			  </ul>
        	<div id="ltc" class="layui-tab-content" style="height: 680px;">
			    <div class="layui-tab-item layui-show">
				    <div class="t_content" style="height: 550px;">
				    	<table class="layui-table"  lay-even lay-skin="row" lay-size="lg">
					    	<thead>
					    		<tr>
					    			<th>房间类型</th>
					    			<th>房间优惠</th>
					    			<th>操作</th>
					    		</tr>
					    	</thead>
					    	<tbody id="typetbody">
					    		<tr>
					    			<td>豪华房</td>
					    			<td>9.5折</td>
					    			<td><input class="layui-btn" type="button" value="修改优惠" data-toggle="modal" data-target="#myModal"></input></td>
					    		</tr>
					    	</tbody>
				    	</table>
				    </div>
			 	</div>
			    <div class="layui-tab-item">
			    	<div class="t_content" style="height: 550px;">
				    	<table class="layui-table"  lay-even lay-skin="row" lay-size="lg">
					    	<thead>
					    		<tr>
					    			<th>会员等级</th>
					    			<th>会员优惠</th>
					    			<th>操作</th>
					    		</tr>
					    	</thead>
					    	<tbody>
					    		<tr>
					    			<td>大众会员</td>
					    			<td>9.5折</td>
					    			<td><input class="layui-btn" type="button" value="修改优惠" data-toggle="modal" data-target="#myModal1"></input></td>
					    		</tr>
					    		<tr>
					    			<td>白金会员会员</td>
					    			<td>8折</td>
					    			<td><input class="layui-btn" type="button" value="修改优惠" data-toggle="modal" data-target="#myModal1"></input></td>
					    		</tr>
					    		<tr>
					    			<td>黑卡会员</td>
					    			<td>7折</td>
					    			<td><input class="layui-btn" type="button" value="修改优惠" data-toggle="modal" data-target="#myModal1"></input></td>
					    		</tr>
					    	</tbody>
				    	</table>
				    </div>
			    </div>
			</div>
        </div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © MISS酒店
    </div>
    

    
    
</div>
 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
  <div class="modal-dialog" style="z-index: 1041;">
    <div class="modal-content" >
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">修改房间优惠</h4>
      </div>
      <div class="modal-body">
        <form action="" enctype="multipart/form-data" method="post" role="form"  id="addvip">
        	<div style="display: inline-block;width: 400px;" class="form-group">
	           		<div class="form-group" style="margin-top: 20px;">
	           			<label for="cla.name">房间类型：</label>
	           			<span id="show_typename"></span>
	           		</div>
	           		<div class="form-group" style="margin-top: 20px;">
	           			<label for="cla.name">房间价格：</label>
	           			<span id="show_typeprice"></span>
	           		</div>
	           		<div class="form-group">
		    			<label style="margin-bottom: 10px;float: left;margin-top: 10px;">设置优惠：</label>
		    			<div class="row" style="display: inline-block;">
		    				<div class="col-md-5" >
		    					<input style="display: inline-block;width: 140px;" type="text" class="form-control" id="discounts"  placeholder="不打折">
		    				</div>
		    			</div>
		           	</div>
	           </div>
    		<div class="modal-footer">
		        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
		        <button type="button" class="btn btn-primary" onclick="changedis()">提交</button>
	     	</div>
        </form>
       </div>
    </div>
  </div>
</div><!-- /.modal -->
 <div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
  <div class="modal-dialog" >
    <div class="modal-content" >
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">修改vip</h4>
      </div>
      <div class="modal-body">
        <form action="" enctype="multipart/form-data" method="post" role="form"  id="addvip">
        	<div style="display: inline-block;width: 400px;" class="form-group">
	           		<div style="margin-top: 20px;">
	           			<label for="cla.name">会员等级：</label>
	           			<span id="show_typename"></span>
	           		</div>
	           		<div style="margin-top: 20px;">
	           			<label for="cla.name">会员优惠：</label>
	           			<span id="show_typeprice"></span>
	           		</div>
	           		<div style="margin-top: 20px;">
	           			<label for="cla.typestock">升级金额：</label>
	           			<span id="show_card"></span>
	           		</div>
	           		<div class="form-group">
		    			<label style="margin-bottom: 10px;float: left;margin-top: 10px;">设置会员：</label>
		    			<div class="row" style="display: inline-block;">
		    				<div class="col-md-5" >
		    					<input style="display: inline-block;width: 140px;" type="text" class="form-control" id="discounts"  placeholder="不打折">
		    				</div>
		    			</div>
		           	</div>
	           </div>
    		<div class="modal-footer">
		        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
		        <button type="button" class="btn btn-primary" onclick="change()">提交</button>
	     	</div>
        </form>
       </div>
    </div>
  </div>
</div><!-- /.modal -->
<script src="../js/layui.all.js"></script>
<script src="../js/jquery.min.js"></script>
<script src="../bt/modal.js"></script>
<script>
var rtid ;
var uid;
layui.use(['element', 'layer'], function(){
  var element = layui.element
  ,layer = layui.layer;
  
  element.on('tab(docDemoTabBrief)', function(data){
    layer.msg('切到到了'+ data.index + '：' + this.innerHTML);
  });
});
$(function(){
	$.ajax({
		url:"/roomtype",
		type:"get",
		async:true,
		dataType:"json",
		success:function(mes){
			console.info(mes)
			var str = "";
			for (var i = 0; i < mes.length; i++) {
				var dis = mes[i].discounts*10;
				if(dis==10){
					dis="不打折";
				}else{
					dis = dis +"折";
				}
				str+="<tr><td>"+mes[i].name+"</td><td>"+dis+"</td><td>"+
				"<button class='layui-btn' type='button'  data-toggle='modal' data-target='#myModal'>修改优惠<input type='hidden' value='"+mes[i].id+"'/> </button></td></tr>";
			}
			$("#typetbody").html(str);
		}
	})
	
	/* $.ajax({
		
	}) */
})

$('#myModal').on('show.bs.modal', function (e){
   rtid = $(e.relatedTarget).children("input").val();
	var pri ;
	 $.ajax({
		url:"/roomtype/"+rtid,
	 	type:"get",
	 	async:true,
		dataType:"json",
		success:function(mes){
		pri = mes.price+"  人民币/天"
			$("#show_typename").html(mes.name);
			$("#show_typeprice").html(pri)
		}
	}) 
})
function changedis(){
	var price = $("#discounts").val();
	var res = {"id":rtid,"discounts":price}
	$.ajax({
		url:"/roomtype",
		type:"put",
		async:true,
		data:JSON.stringify(res),
		contentType:"application/json;charset=utf-8",
		success:function(mes){
			alert(mes)
			$('#myModal').modal('hide');
		}
	})
}
$('#myModal').on('hidden.bs.modal', function (){
	$("#show_typename").html("");
	$("#show_typeprice").html("")
})
$('#myModal1').on('show.bs.modal', function (e){
	
})
$('#myModal1').on('hidden.bs.modal', function (){
	
})
</script>
</body>
</html>